<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>绑定账户</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta content="telephone=no,email=no,address=no" name="format-detection" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta name="msapplication-tap-highlight" content="no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="wap-font-scale" content="no">
		<meta name="Keywords" content="用户中心" />
		<meta name="Description" content="用户中心" />
		<link rel="stylesheet" href="__TMPL__Public/css/common.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/user.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/public.css" />
<script type="text/javascript" src="/themes/wnsc_moblie/newMobile/User/js/area/jquery.min.js"></script>
	<script type="text/javascript" src="__TMPL__Public/js/common.js"></script>
		<style>
			.header {
				position: relative;
				width: 100%;
				height: 50px;
				background: #fafafa;
				zoom: 1;
				border-bottom: 1px solid #eee;
			}
			.phone-icon {
				background: url(/themes/wnsc_moblie/Public/images/phone.png) no-repeat center center;
				background-size: auto 20px;
			}
		</style>
	</head>

	<body>
		<input type="file"  accept="image/*" name="logo" id="upload_pic" style="display: none;">
		<div class="user-info-box">
			<?php
				$agent = $_SERVER['HTTP_USER_AGENT'];
				if(strpos($agent,"Html5Plus") === false){
			?>
			<header>
				<div class="header">
					<div class="header-left">
						<a class="sb-back" href="{:U('user/center')}" title="返回"></a>
					</div>
					<div class="header-middle">绑定账户</div>
					<div class="header-right">
						<aside class="show-menu-btn">
							<div class="show-menu" id="show_more">
								<a href="javascript:void(0);"></a>
							</div>
						</aside>
					</div>
				</div>
			</header>
			<mtc_include file="Public:right_nav" />
			<?php
				}
			?>
			<dl class="nickname_dl">
				<dt  style="margin-left: 0.2rem;">
					<em class="phone-icon" style="display: block;float: left; width: 8%; height: 25px; margin-right: 3px;"></em>
					<h3>手机 <notempty name="user_info['phone']"><em style="font-size: 12px;">({$user_info['phone']})</em></notempty></h3>
					<h5>
						<php>if($user_info['phone']==null||$user_info['phone']==''){</php>
								<i  style="width:45px" onclick="window.location.href='/user/bd_phone'">未绑定</i>
						<php>	}else{ </php>
								<i  style="width:60px">不可解绑</i>
						<php>	} </php>
						<i class="iconfont"></i>
					</h5>
				</dt>
			</dl>
			
			<dl>
				<dt style="margin-left: 0.2rem;">
					<em class="weixin-icon" style="display: block;float: left; width: 8%; height: 25px; margin-right: 3px;"></em>
					<h3>微信 <notempty name="user_info['wx_name']"><em style="font-size: 12px;">({$user_info['wx_name']})</em></notempty></h3>
					<h5>
						<php>if($user_info['wx_unionid']==null){</php>
								<i class="weixin_wbd" style="width:45px">未绑定</i>
						<php>	}else{ </php>
								<i class=""  style="width:55px">已绑定</i>
						<php>	} </php>
						
						<i class="iconfont"></i>
					</h5>
				</dt>
			</dl>
			<dl>
				<dt style="margin-left: 0.2rem;">
					<em class="qq-icon" style="display: block;float: left; width: 8%; height: 25px; margin-right: 3px;"></em>
					<h3>QQ <notempty name="user_info['qq_name']"><em style="font-size: 12px;">({$user_info['qq_name']})</em></notempty></h3>
					<h5>
						<php>if($user_info['qq_openid']==null||$user_info['qq_openid']==''){</php>
								<i class="qq_wbd" style="width:45px">未绑定</i>
						<php>	}else{ </php>
								<i class=""  style="width:55px">已绑定</i>
						<php>	} </php>
						
						<i class="iconfont"></i>
					</h5>
				</dt>
			</dl>
			<dl>
				<dt style="margin-left: 0.2rem;">
					<em class="weibo-icon" style="display: block;float: left; width: 8%; height: 25px; margin-right: 3px;"></em>
					<h3>微博 <notempty name="user_info['wb_name']"><em style="font-size: 12px;">({$user_info['wb_name']})</em></notempty></h3>
					<h5>
						<php>if($user_info['wb_openid']==null||$user_info['wb_openid']==''){</php>
								<i class="wb_wbd" style="width:45px">未绑定</i>
						<php>	}else{ </php>
								<i class=""  style="width:55px">已绑定</i>
						<php>	} </php>
						
						<i class="iconfont"></i>
					</h5>
				</dt>
			</dl>
		
			
		</div>
		
		<script src="/themes/wnsc_moblie/newMobile/User/login/js/mobile/layer.js"></script>
	
		
		<script>
		<php> 	
			$isweixin=is_weixin();
			if($isweixin){
		</php>
			var is_weixin=1;
		<php> }else{</php> 
			var is_weixin=0;
		<php> }</php> 
		</script>
		<script>
			$(function(){
				
				$('.weixin_wbd').click(function(){
			
					if(is_weixin==1){
						layer.open({
							content: '是否与当前微信账号绑定？'
							,btn: ['确定','不了']
							,yes: function(index){
							  $.ajax({
								type : "post",
								url : "/user/weixin_bd",
								dataType : "json",
								data : {
									"is_weixin" : is_weixin
								},
								beforeSend: function () {
									layer.open({
										content: '绑定中...'
										,skin: 'msg'
										,time: 2 //2秒后自动关闭
									  });
								},
								success : function(data) {
									if(data.code==2){
											//询问框
										  layer.open({
											content: data.msg
											,btn: ['确定', '不要']
											,yes: function(index){
												weixinbd();
											}
										  });
									}else{
										layer.open({
											content: data.msg
											,skin: 'msg'
											,time: 2 //2秒后自动关闭
										});
									   setTimeout('window.location.reload();',1000);
									}
									
								}
								
							});
							}
						  });
						
					}else{
						layer.open({
							content: '请在微信端打开绑定'
							,skin: 'msg'
							,time: 2 //2秒后自动关闭
						 });
					}
				})
				
				$('.qq_wbd').click(function(){
						location="/user/qq_bd"
				})
				
				$('.wb_wbd').click(function(){
						location="https://api.weibo.com/oauth2/authorize?client_id=<?=C('wb_login.WEIBO_APP_KEY')?>&redirect_uri=<?=C('wb_login.WEIBO_MOBLIE_URL')?>&response_type=code&code=<?=md5(time())?>"
				})
		
				
			
			})
			
			function weixinbd(){
				 $.ajax({
					type : "post",
					url : "/user/weixin_twobd",
					dataType : "json",
					data : {
						"is_weixin" : is_weixin
					},
					beforeSend: function () {
						layer.open({
							content: '绑定中...'
							,skin: 'msg'
							,time: 2 //2秒后自动关闭
						  });
					},
					success : function(data) {
						
							layer.open({
								content: data.msg
								,skin: 'msg'
								,time: 2 //2秒后自动关闭
							});
						   setTimeout('window.location.reload();',1000);
					}
				});
			}
		</script>
		
	</body>

</html>